package com.springcloud.controller;

import com.springcloud.pojo.Dept;
import com.springcloud.service.DeptConsumerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 周恒哲
 * @date 2020/02/02
 **/
@RestController
public class DeptConsumerController {
    @Autowired
    private DeptConsumerService deptConsumerService;

    @RequestMapping("/consumer/dept/add")
    public boolean add(Dept dept){
        return deptConsumerService.addDept(dept);
    }
    @RequestMapping("/consumer/dept/get/{deptno}")
    public Dept get(@PathVariable("deptno") Long deptno){
        return deptConsumerService.queryById(deptno);
    }
    @RequestMapping("/consumer/dept/list")
    public List<Dept> list(){
        return deptConsumerService.queryAll();
    }
}
